package com.xxx.string;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/19 9:29
 * @Copyright 博为峰
 */
public class StringDemo01 {
    //String特点：字符串常量
    public static void main(String[] args) {
//        m1();
//        m2();
        String s1 = "abc";
        s1 = "cba";
        String s2 = new String("cba");//创建两个对象
    }

    public static void m2() {
        String s1 = new String("abc");
//        System.out.println(s1);

        String s2 = "abc";

//        System.out.println(s1 == s2);
        System.out.println(s1.equals(s2));
    }

    public static void m1() {
        byte[] bytes = {97, 98, 99};
        String s1 = new String(bytes);
        System.out.println(s1);
    }
}
